package website.digitalocean.chapter7;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author: longhc@citycloud.com.cn
 * @since: 2023/2/10 11:00
 * @version: 1.0
 */
@Slf4j
public class RealImage implements Image {

    private String name;

    public RealImage(String name) {
        this.name = name;
        loadImg(name);
    }

    @Override
    public void display() {
        log.info("展示图片; name:{}", this.name);
    }

    /**
     * <p>耗费时间的步骤</p>
     * @param name
     */
    private void loadImg(String name) {
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("加载图片成功; name:{}", name);
    }
}
